<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    div {
      height: 100px;
      width: 100px;
      background: black;
      transition: background 1s;
    }
    div:hover {
      background: red;
    }
  
  </style>
</head>
<body>
  <div></div>

  <!-- 
    transitionend


   -->
  <script>
    var div = document.querySelector('div')
    /* div.ontransitionend = function () {
      console.log('过渡结束')
    } */
    div.addEventListener('transitionend', function () {
      console.log('过渡结束')
    })
  </script>
</body>
</html>